﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ue.Extensions;

namespace Ue.Tests.Extensions
{
    /// <summary>
    /// ObjectExtensions 的摘要说明
    /// </summary>
    [TestClass]
    public class ObjectExtensionTests
    {
        #region CombineHashCode

        [TestMethod]
        public void GetCombineHashCode()
        {
            var obj = new object();

            Assert.AreEqual(obj.GetHashCode(), obj.GetCombineHashCode());

            Assert.IsFalse(obj.GetHashCode()==obj.GetCombineHashCode(new object()));

            Assert.IsFalse(obj.GetCombineHashCode(new object()) == obj.GetCombineHashCode(new object()));
        }

        [TestMethod]
        public void NullOfAllArgs()
        {
            object obj = null;

            Assert.AreEqual(0, obj.GetCombineHashCode());
            Assert.AreEqual(0,obj.GetCombineHashCode(null));
        }

        [TestMethod]
        public void ColIsNull()
        {
            object obj = null;
            object obj2=new object();

            Assert.AreEqual(obj2.GetHashCode(),obj.GetCombineHashCode(obj2));
        }

        #endregion

        #region Format

        [TestMethod]
        public void Format()
        {
            Assert.AreEqual("2001-08-12月",DateTime.Parse("2001-08-12").Format("yyyy-MM-dd月"));
        }

        #endregion
    }
}
